<?php if (Yii::app()->session["member_level"] != "admin" and Yii::app()->session["member_id"] == NULL): 
echo $this->redirect(Yii::app()->homeUrl);
endif; ?>
<?php
$form = $this->beginWidget('CActiveForm', array(
    'id' => 'employee-form',
    'enableAjaxValidation' => false,
        ));
?>

<div class="panel" style="margin-left: 10px">
    <div class="panel_header">ลงทะเบียนเป็นสมาชิกในระบบ</div>
    <div class="panel_header"><?php echo CHtml::link("กลับหน้าแรก", "index.php?r=setting/Member"); ?></div>
    <div class="panel_body grid-view">
        <table class="items" width="100%">
            <thead>
                <tr>
                    <th width="370px">ข้อมูลทั่วไป</th>
                    <!--<th>กลุ่มผู้ใช้งานระบบ</th>-->
                </tr>
            </thead> 
            <tbody>
                <tr valign="top">
                    <td>
                        <div>
                            <p>Fields with * are required.</p>
                        </div>
                        <div>
                            <?php
                            $records = MemberGroup::model()->findAll();
                            $list = CHtml::listData($records, 'id', 'member_group_name_thai');
                            echo $form->labelEx($model, "member_group_id");
                            echo $form->dropDownList($model,'member_group_id', $list, array('empty' => '(Select a group'));
                            ?>
                        </div>
                        
                        <div>
                            
                            <?php echo $form->labelEx($model, "member_sex"); ?>
                            <?php // echo $form->radioButton($model, "member_sex", array("value" => "m")); ?> 
                            <?php // echo $form->radioButton($model, "member_sex", array("value" => "f")); ?> 
                            
                            <?php                    
                            $data = array(
                                    "m" => "ชาย",
                                    "f" => "หญิง");
                            echo $form->radioButtonList($model,"member_sex",$data);
                            ?>
                           
                        </div>
                        
                        <div>
                            <?php echo $form->labelEx($model, "member_firstname"); ?>
                            <?php echo $form->textField($model, "member_firstname"); ?>
                            <?php // echo $form->error($model,"member_firstname"); ?>
                        </div>
                        
                        <div>
                            <?php echo $form->labelEx($model, "member_lastname"); ?>
                            <?php echo $form->textField($model, "member_lastname"); ?>
                        </div>
                        
                        <div>
                            <?php echo $form->labelEx($model,'member_birth_date'); ?>
                            <?php $this->widget('zii.widgets.jui.CJuiDatePicker',array(
                                'name'=>'member_birth_date',
                                'model'=>$model,
                                'attribute'=>'member_birth_date',
                                // additional javascript options for the date picker plugin
//                                'options'=>array( 'showAnim'=>'fold',
//                                ),
                                'options'=>array('changeMonth'=>'true', 'changeYear'=>'true'
                                    ,'dateFormat'=>'yy-mm-dd',
                                    'buttonText'=>'Select Date',
                                    'showAnim'=>'fold',
                                    'showOn'=>'button',
                                    'showButtonPanel'=>false,
                                    'yearRange'=>'1900',
                                    'showAnim'=>'fold',),

                                'htmlOptions'=>array(
                                    'style'=>'height:20px;',
                                    'color'=>'red',
                                    'bgcolor'=>'#FF0000'
                                ),
                            ));?>
                              <?php // echo $form->error($model,'member_birth_date'); ?>
                        </div>
                        
                        <div>
                            <?php echo $form->labelEx($model, "member_username"); ?>
                            <?php echo $form->textField($model, "member_username"); ?>
                        </div>
                        
                        <div>
                            <?php echo $form->labelEx($model, "member_password"); ?>
                            <?php echo $form->passwordField($model, "member_password"); ?>
                        </div>
                        
                        <div>
                            <?php echo $form->labelEx($model, "member_address"); ?>
                            <?php echo $form->textArea($model, "member_address",array("cols"=>50,"rows"=>8)); ?>
                        </div>
                        
                        <div>
                            <?php echo $form->labelEx($model, "member_email"); ?>
                            <?php echo $form->textField($model, "member_email"); ?>
                            <?php echo $form->error($model,"member_email"); ?>
                        </div>
                        
                        <div>
                            <?php echo $form->labelEx($model, "member_tel"); ?>
                            <?php echo $form->textField($model, "member_tel"); ?>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <?php echo $form->hiddenField($model,"id"); ?>
                        <?php echo CHtml::submitButton("บันทึกรายการ >", array("class" => "button")); ?>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
<?php $this->endWidget(); ?>